#include "qshapedrawcell.h"

QNamespaceStart(Qui)

void QShapeDrawCell::draw()
{
	appy_attribute();

	if (get_line_color() == -1 &&
		get_fill_color() == -1)

	{
		return;
	}

	switch (cell_shape)
	{
	case QShapeRound:
	{
		if (get_line_color() == -1)
		{
			QDrawFillEllipse(get_position().x, get_position().y,
				get_position().width, get_position().height);
		}
		else
		{
			QDrawSoildEllipse(get_position().x, get_position().y,
				get_position().width, get_position().height);
		}

		break;
	}
	case QShapePolygon:
	{
		if (get_line_color() == -1)
		{
			QDrawFillPolygon(get_position().x, get_position().y,
				polygon_point, point_count);
		}
		else
		{
			QDrawSoildPolygon(get_position().x, get_position().y,
				polygon_point, point_count);
		}

		break;
	}
	case QShapeRectangle:
	{
		if (get_line_color() == -1)
		{
			QDrawFillRectangle(get_position().x, get_position().y,
				get_position().width, get_position().height);
		}
		else
		{
			QDrawFillRectangle(get_position().x, get_position().y,
				get_position().width, get_position().height);
		}

		break;
	}
	}

	restore_attribute();
}

QNamespaceEnd